package cn.dnf.fallbackFactory;

import cn.dnf.domain.Ticket;
import cn.dnf.domain.User;
import cn.dnf.feign.MovieFeignClients;
import cn.dnf.util.JsonResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class MovieFallbackFactory implements FallbackFactory<MovieFeignClients> {
    @Override
    public MovieFeignClients create(Throwable throwable) {
        return new MovieFeignClients() {
            @Override
            public Ticket findById(Long id) {
                return new Ticket();
            }

            @Override
            public void update(Ticket ticket) {

            }

            @Override
            public List<Ticket> findAll() {
                return null;
            }

            @Override
            public JsonResult watch(Long id) {
                return JsonResult.success().setMessage("哈哈哈哈");
            }

            @Override
            public void gift(User user) {

            }
        };
    }
}
